require 'DictService.rb'
require 'DictServiceMappingRegistry.rb'
require 'soap/rpc/driver'

module DictService

class DictServiceSoap < ::SOAP::RPC::Driver
  DefaultEndpointUrl = "http://services.aonaware.com/DictService/DictService.asmx"

  Methods = [
    [ "http://services.aonaware.com/webservices/ServerInfo",
      "serverInfo",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "ServerInfo"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "ServerInfoResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/DictionaryList",
      "dictionaryList",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DictionaryList"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DictionaryListResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/DictionaryListExtended",
      "dictionaryListExtended",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DictionaryListExtended"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DictionaryListExtendedResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/DictionaryInfo",
      "dictionaryInfo",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DictionaryInfo"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DictionaryInfoResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/Define",
      "define",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "Define"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DefineResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/DefineInDict",
      "defineInDict",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DefineInDict"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "DefineInDictResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/StrategyList",
      "strategyList",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "StrategyList"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "StrategyListResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/Match",
      "match",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "Match"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "MatchResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ],
    [ "http://services.aonaware.com/webservices/MatchInDict",
      "matchInDict",
      [ ["in", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "MatchInDict"]],
        ["out", "parameters", ["::SOAP::SOAPElement", "http://services.aonaware.com/webservices/", "MatchInDictResponse"]] ],
      { :request_style =>  :document, :request_use =>  :literal,
        :response_style => :document, :response_use => :literal,
        :faults => {} }
    ]
  ]

  def initialize(endpoint_url = nil)
    endpoint_url ||= DefaultEndpointUrl
    super(endpoint_url, nil)
    self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
    self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
    init_methods
  end

private

  def init_methods
    Methods.each do |definitions|
      opt = definitions.last
      if opt[:request_style] == :document
        add_document_operation(*definitions)
      else
        add_rpc_operation(*definitions)
        qname = definitions[0]
        name = definitions[2]
        if qname.name != name and qname.name.capitalize == name.capitalize
          ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
            __send__(name, *arg)
          end
        end
      end
    end
  end
end




end
